package com.lagou.edu.boot;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
import org.springframework.context.ConfigurableApplicationContext;

import javax.servlet.ServletException;

public class SpringApplication {


    public static void run() throws LifecycleException {
        //1.创建tomcat
        Tomcat t=new Tomcat();
        //2.设置端口
        t.setPort(8080);
        try {
            t.addWebapp("/", "D:\\");
            //3.启动tomcat
            t.start();
            //4.阻塞当前线程
            t.getServer().await();
        } catch (ServletException e) {
            e.printStackTrace();
        }


    }
}
